package com.lbn.monitor.widget.calendar;

import android.content.Context;
import android.graphics.Color;
import android.widget.TextView;


import com.lbn.monitor.R;

import java.util.List;

import indi.free.widgets.custom_recycler_view.BaseRecyclerAdapter;
import indi.free.widgets.custom_recycler_view.RecyclerViewHolder;

/**
 * Created by Administrator on 2016/9/14.
 */
public class CalendarAdapter extends BaseRecyclerAdapter<CalendarData> {

    private int month;

    public CalendarAdapter(Context ctx, List list, int month) {
        super(ctx, list);
        this.month = month;
    }

    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.fragment_calendar_item;
    }


    @Override
    public void bindData(RecyclerViewHolder holder, int position, CalendarData item) {

        TextView textView = holder.getView(R.id.item);

        textView.setText(String.valueOf(item.day));

        if(month!=item.month){
            textView.setTextColor(Color.parseColor("#999999"));
        }else{
            textView.setTextColor(Color.parseColor("#000000"));
        }

        if(item.state==1){
            textView.setTextColor(Color.parseColor("#ffffff"));
            textView.setBackgroundResource(R.drawable.calendar_item_bg);
        }else{
            textView.setBackgroundResource(android.R.color.transparent);
        }

    }
}
